package com.webbei.Backstage.action;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.apache.struts2.ServletActionContext;

import com.webbei.Backstage.service.BackstateSer;

public class UpdatePwdAction {
	private String newPwd;
	private String managerName;
	private BackstateSer bao;
	public String execute(){
		System.out.println(newPwd+"---"+managerName);
		Map<String,String> map=new HashMap<String, String>();
		map.put("managersName", managerName.trim());
		map.put("newPwd", newPwd.trim());
		int i=bao.updatePwdByUserName(map);
		if(i==1){
			try {
				ServletActionContext.getResponse().getWriter().write("success");
				ServletActionContext.getResponse().setContentType("text/html");
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}else{
			try {
				ServletActionContext.getResponse().getWriter().write("fail");
				ServletActionContext.getResponse().setContentType("text/html");
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		System.out.println("i:"+i);
		return null;
	}
	
	public BackstateSer getBao() {
		return bao;
	}

	public void setBao(BackstateSer bao) {
		this.bao = bao;
	}

	public String getNewPwd() {
		return newPwd;
	}
	public void setNewPwd(String newPwd) {
		this.newPwd = newPwd;
	}
	public String getManagerName() {
		return managerName;
	}
	public void setManagerName(String managerName) {
		this.managerName = managerName;
	}
	
}
